<?php
class MemManageAction extends Action{
    
    public function memManage(){    	
    	//$this->assign("validateMenuJuri",true);
        //global $cookieTools;
        //$qiaoba = $cookieTools->getCookie('qiaoba');
        //$this->smarty->assign("qiaoba",$qiaoba);
        //smartyDisplay($this->smarty,'/manage/page/systemmanage/systemusermanage/userManage.html');
    	$this->assign("smarty",'/manage/page/financesystem/financemanage/memManage.html');
        
        return $this->SMARTY;
    }

    //为用户充值
    public function userRechange(){
    	global $param,$userSession;
    	$params = $param->getParams();
    	$params['myUserId']=$userSession->getUserSession()["userId"];
    	
    	tsLoad('/manage/busi/SysMemUserPage.class.php');
    	 
    	$sysMemUserPage = new SysMemUserPage();
    	$result = $sysMemUserPage->userRechange($params);
    	
    	$this->assign("result",$result);
    	return $this->JSON;
    }
    
    /**
     * 升级一个未激活用户为会员
     * @return string
     */
    public function updateUnMemToMem(){
    	global $param;
    	$params = $param->getParams();
    	tsLoad('/manage/busi/SysMemUserPage.class.php');
    	 
    	$sysMemUserPage = new SysMemUserPage();
    	$result = $sysMemUserPage->updateUserToMem($params);
    	
    	$this->assign("result",$result);
    	return $this->JSON;
    }
    
    /**
     * 升级一个未激活用户为报单用户
     * @return string
     */
    public function updateUnMemToCenter(){
    	global $param;
    	$params = $param->getParams();
    	tsLoad('/manage/busi/SysMemUserPage.class.php');
    
    	$sysMemUserPage = new SysMemUserPage();
    	$result = $sysMemUserPage->updateUserToCenter($params);
    	 
    	$this->assign("result",$result);
    	return $this->JSON;
    }
    
    /**
     * 升级一个会员为报单用户
     * @return string
     */
    public function updateMemToCenter(){
    	global $param;
    	$params = $param->getParams();
    	tsLoad('/manage/busi/SysMemUserPage.class.php');
    
    	$sysMemUserPage = new SysMemUserPage();
    	$result = $sysMemUserPage->updateMemToCenter($params);
    
    	$this->assign("result",$result);
    	return $this->JSON;
    }
    
    public function queryUserInfo(){
    	global $param;
    	$params = $param->getParams();
    	tsLoad('/manage/busi/SysMemUserPage.class.php');
    	
    	//收集当前传入的当前页信息
    	if($params['page']!=null)
    		$currentPage = $params['page'];
    	else
    		$currentPage =1;
    	//收集当前传入的一页多少条信息
    	if($params['rows']!=null)
    		$countPage = $params['rows'];
    	else
    		$countPage =10;
    	$sysMemUserPage = new SysMemUserPage();
    	$pageInfo = $sysMemUserPage->initPage($params, $countPage, $currentPage);
    	$rows = $sysMemUserPage->getCurPageData();
    	
    	$this->assign("total",$pageInfo['countRow']);
    	$this->assign("rows",$rows);
    	return $this->JSON;
    }
    
    //根据用户ID查询用户信息
    public function queryMoneySum(){
    	global $param;
    	$params = $param->getParams();
    	tsLoad('/manage/busi/SysMemUserPage.class.php');
    	$sysMemUserPage = new SysMemUserPage();
    	$this->assign("result",$sysMemUserPage->queryMoneySum($params));
    	return $this->JSON;
    }
    
    //根据用户ID查询用户信息
    public function getUserById(){
    	global $param;
    	$params = $param->getParams();
    	tsLoad('/manage/busi/SysUserPage.class.php');
    	
    	$sysUserPage = new SysUserPage();
    	$userInfo = $sysUserPage->getUserById($params);
    	
    	$this->assign("userInfo",$userInfo);
    	return $this->JSON;
    }
    
	//修改用户信息
    public function updateUserInfo(){
    	global $param;
    	$params = $param->getParams();
    	tsLoad('/manage/busi/SysUserPage.class.php');
    	 
    	$sysUserPage = new SysUserPage();
    	$result = $sysUserPage->updateUser($params);
    	 
    	$this->assign("result",$result);
    	return $this->JSON;
    }
}
?>